home *** CD-ROM | disk | FTP | other *** search
/ Network CD 1 / Network CD.iso / tbag / 1-10 / tb10 / doc-files / utilities-doc-files / journal.doc < prev    next >
Text File  |  1987-07-16  |  23KB  |  475 lines

  1.  
  2. PLEASE!!! read Journal.DOC. it is VERY important for you to get a
  3. full understanding of what these programs do, and how they work.
  4.  
  5. This pair of programs has unbelieveable potential for Amiga demonstrations!
  6. JOURNAL is, in MY personal opinion, one of the most important freely
  7. distributable piece of Amigaware ever released.
  8.  
  9. I've included a Journal file which you can Playback to see an example
  10. of what I'm talking about.
  11.  
  12. The Journal file is called HarvDemo and it makes the following
  13. assumptions:
  14.  
  15. 1) that you have ED in your C: directory
  16.  
  17. 2) that you know how to open a CLI window and type into it.
  18.  
  19. 3) that you are using a Standard 80 column preferences setting, and
  20.    not "MoreRows" or Interlace or anything else other than a standard
  21.    default screen setting.
  22.  
  23. 4) that your CLI window is stretched out to full screen size.
  24.  
  25. The HarvDemo will *NOT* write any files to your disk, so don't worry.
  26. The demo will last about 3 minutes or so.
  27.  
  28. Since PLAYBACK requires that YOUR screen be set up the same way as
  29. was the person's who created the JOURNAL entry to begin with, please make
  30. sure the above conditions are met before you playback HarvDemo.
  31.  
  32. I have specifically left out any icon movement or disk openings and
  33. closings because I have no way to know how you might have modified your
  34. Workbench environment and PLAYBACK requires that everything be in
  35. the same place on the computer playing back the demo as well as the
  36. computer that recorded the demo (see JOURNAL.DOC for a deeper explanation
  37. of this) so I've made this a very simple yet effective demo.
  38.  
  39. What you will see when you type RUN PLAYBACK HARVDEMO from your CLI
  40. prompt is, in effect, what you would have seen had you been sitting
  41. next to me as I created the demo! It will run in virtually REAL TIME,
  42. and, as JOURNAL's author says, is "spooky."
  43.  
  44. So... as a last thought, I say to the programmers, software companies,
  45. Amiga dealers, user group leaders, and telecomm users out there...
  46. 'THINK OF THE POSSIBILITIES!!'
  47.  
  48. And Thank You to Davide P. Cervone for creating this incredibly useful
  49. program!
  50.  
  51. Regards,
  52. Harv Laser
  53. Chairman/Sysop, the Plink AmigaZone Club
  54. 15 July 1987
  55.  
  56. ps...it has occured to me that since PLAYBACK takes over your system
  57. (you can abort it but you can't use your keyboard or mouse while the
  58. playback is running except for the control-C abort), that evil people
  59. could use this program for nefarious purposes, to erase other's disks
  60. and such. Therefore, unless you know beforehand that the person who
  61. created the Journal entry had no nasty intent in mind...you might want
  62. to write protect your disks before running an untested Journal file!
  63.  
  64. 30
  65.  
  66. Message-ID: #30.pnet02.amiga/netsrc 20468 chars. (5 more)
  67. From: dpvc@ur-tut.UUCP (Davide P. Cervone)
  68. Newsgroups: comp.sources.amiga
  69. Subject: Journal and Playback (documentation)
  70. Date: 10 Jul 87 18:57:20 GMT
  71. Reply-To: doc@s.cc.purdue.edu (Craig Norborg)
  72. Organization: Purdue University Computing Center
  73.  
  74.  
  75.     Here is the documentation to a neat utility that allows you to
  76. record and playback events that happen in a window.  Binaries and
  77. sources available in respective groups!
  78.     -Doc
  79.  
  80.  
  81. #       This is a shell archive.
  82. #       Remove everything above and including the cut line.
  83. #       Then run the rest of the file through sh.
  84. #----cut here-----cut here-----cut here-----cut here----#
  85. #!/bin/sh
  86. # shar: Shell Archiver
  87. #       Run the following text with /bin/sh to create:
  88. #       README
  89. #       journal.doc
  90. # This archive created: Fri Jul 10 13:53:16 1987
  91. # By:   Craig Norborg (Purdue University Computing Center)
  92. cat << \SHAR_EOF > README
  93. Well, when I was working on MonIDCMP, I wanted to provide a real-life example
  94. of how it could be used for something useful (like HARDCOPY was to MONPROC).
  95. I thought, "Wouldn't it be great to be able to record and play back the events
  96. that went on in a window?"  You could make "Guided Tour" demonstrations, or
  97. turnkey systems that perform all kinds of mouse and keyboard activity, or
  98. you could record the events that demonstrate a bug that you have been able to
  99. produce and send the recorded events to Commodore as documentation of the bug.
  100.  
  101. But MonIDCMP doesn't have the power to accomplish this:  it can trick a
  102. window into thinking that things have happened, but gadgets would not REALLY be
  103. pressed, and windows would not REALY be resized.  To do it right you have to go
  104. directly to the Input Device and look at the events that are being passed to
  105. Intuition.
  106.  
  107. I set out to do this.  What I came up with was JOURNAL and PLAYBACK.  To see
  108. what they do and what they are good for, read the following document, which
  109. describes in detail how to use JOURNAL and PLAYBACK.  
  110.  
  111. With a little more work, these could become important documentation tools for
  112. any Amiga software company.  I am willing to do that additional work, but only 
  113. if there is sufficient interest.  If you want to see the enhancements I
  114. discuss below (or any of your own design), please contact me and let me know. 
  115. I did this mainly as an exercise, but think it would be valuable to continue
  116. work on it, but not if I'm the only one who will use it.
  117.  
  118. I hope you find these little programs interesting.  I think they're kind of
  119. spooky myself.  I'm not sure I like it when my computer types things for me 
  120. without my pressing the keys...
  121.  
  122. Davide P. Cervone
  123. dpvc@tut.cc.rochester.EDU
  124. dpvc@ur-tut.UUCP
  125. DPVC@UORDBV.BITNET
  126. SHAR_EOF
  127. cat << \SHAR_EOF > journal.doc
  128. OVERVIEW:
  129.  
  130. JOURNAL is a program that records a sequence of mouse and keyboard events as 
  131. they occur and stores them in a file.  The file can be played back via the
  132. program PLAYBACK, thus causing the same sequence of events to occur again. 
  133. This is useful for creating demonstrations of programs (much like the "Guided
  134. Tours" on the Macintosh computer).  It also is useful for documenting
  135. repeatable bugs:  rather than trying to describe to CATS (or some third-party
  136. vender) what you did that revealed the bug, you could record the actions with
  137. JOURNAL, and send them the output file instead.  Finally, you can use JOURNAL
  138. to set up turnkey demo-disks for conferences and computer shows that will run
  139. unattended while you talk to customers.  It's even possible for PLAYBACK to
  140. restart itself when it comes to the end of the file.  In a future version,
  141. there will be a journal editor that allows you to add "special effects" like
  142. explanation windows that tell the viewer what you are doing, or that call up
  143. the narrator device to "speak" some information as your demonstration
  144. progresses. 
  145.  
  146. JOURNAL may not work with some programs the "take over" the system or bypass
  147. the Input.Device (see USAGE NOTES for additional information).
  148.  
  149.  
  150. HOW TO USE JOURNAL:
  151.  
  152. To run JOURNAL, type:
  153.  
  154.     1> RUN JOURNAL TO <file>
  155.  
  156. where <file> is the name of the journal file that you wish to produce.  JOURNAL
  157. should respond by displaying its version number and telling you how to cancel
  158. it, and by moving the pointer to the upper, left-hand corner of the screen. 
  159. Once the pointer has been moved, JOURNAL will record all the key presses and
  160. mouse movements that you perform, by writing them to the file that you
  161. specified.
  162.  
  163. This file will be used A LOT, so if it is on floppy-disk, be sure that the
  164. disk can be left in the drive, and that it has enough space available for
  165. the journal file.  The journal grows FAST, so do some exparimenting before
  166. you create a long journal file.  RAM: is a good place to write small journals,
  167. but may not be appropriate for long ones, as you may need your RAM space for
  168. the programs that you are running.
  169.  
  170. When you are done creating your journal, press CTRL-LEFTAMIGA-E.  This signals
  171. JOURNAL to stop recording events.  Once you get the "Joural Complete" message,
  172. any further actions will not be added to the journal file.
  173.  
  174.  
  175. HOW JOURNAL WORKS:
  176.  
  177. JOURNAL installs an input handler into the handler chain of the Input.Device. 
  178. This handler's priority puts it ahead of Intuition, so it sees the "undigested"
  179. events as they arrive from the Keyboard.Device, Gameport.Device, and
  180. Timer.Device.  When keyboard or mouse events are passed to the handler, it
  181. copies them into a linked list of events and signals JOURNAL that new events
  182. are ready, then passes the unmodified event list on to Intuition.  JOURNAL
  183. picks up the list of events and packs them into "TinyEvents" that take up
  184. fewer bytes, and records these in the output file.  To save even more space in
  185. the file, JOURNAL compresses multiple mouse move events into single output file
  186. records when possible, but records the number of events that were compressed,
  187. so that they can be recreated by PLAYBACK, if desired.  The amount of 
  188. compression is controlled by command-line options (see below).
  189.  
  190. When the handler sees that CTRL-AMIGA-E has been pressed, it signals JOURNAL,
  191. which tells the Input.Device to remove the handler from the chain and closes
  192. the journal file.
  193.  
  194.  
  195. JOURNAL OPTIONS:
  196.  
  197. JOURNAL supports a number of command-line options that modify its behavior:
  198.  
  199.     TO <file>       Designates <file> as the JOURNAL output file (the keyword
  200.                     "TO" is optional).
  201.     
  202.     DX x            Specifies the amount of x movement that can be compressed
  203.                     into one output event (mouse movements are added together
  204.                     until their conbined x-offsets exceed DX or their
  205.                     combined y-offsets exceed DY).  The default value is 8.
  206.  
  207.     DY y            Specifies the amount of y movement that can be compressed
  208.                     into one output event (mouse movements are added together
  209.                     until their conbined x-offsets exceed DX or their
  210.                     combined y-offsets exceed DY).  The default value is 8.
  211.  
  212.     SMOOTHX x       Specifies an alternate value for DX that is used when extra
  213.                     precision is needed (for example, when you need to draw
  214.                     a free-form line in a paint program).  This value is in
  215.                     effect when the SMOOTH and TRIGGER mask conditions are
  216.                     met (see below).  The default value is 1.
  217.  
  218.     SMOOTHY y       Specifies an alternate value for DY that is used when extra
  219.                     precision is needed (for example, when you need to draw
  220.                     a free-form line in a paint program).  This value is in
  221.                     effect when the SMOOTH and TRIGGER mask conditions are
  222.                     met (see below).  The default value is 1.
  223.  
  224.     SMOOTH mask     Indicates which qualifier keys MUST be pressed in order to 
  225.                     activate the SMOOTHX and SMOOTHY values.  Whan ALL the
  226.                     keys specified by the SMOOTH mask are pressed, and AT LEAST
  227.                     ONE of the keys designated by the TRIGGER mask is pressed,
  228.                     then the SMOOTHX and SMOOTHY values are used in place of 
  229.                     DX and DY.  By default, the left Amiga key specifies
  230.                     smoothing.
  231.  
  232.     TRIGGER mask    Indicates which qualifier keys trigger the use of SMOOTHX
  233.                     and SMOOTHY.  When ANY ONE of the keys indicated by TRIGGER
  234.                     mask is pressed, and ALL of the keys specified by the
  235.                     SMOOTH mask are pressed, then SMOOTHX and SMOOTHY are used
  236.                     in place of DX and DY.  By default, any qualifier key 
  237.                     triggers smoothing.
  238.  
  239. For people who understand "C" syntax, the expression that determines whether
  240. to use DX and DY or SMOOTHX and SMOOTHY is the following:
  241.  
  242.   if (((Qualifiers & SmoothMask) == SmoothMask) && (Qualifiers & TriggerMask))
  243.     use SMOOTHX and SMOOTHY
  244.    else
  245.     use DX and DY
  246.  
  247. Note that this provides considerable flexibility in specifying what will
  248. activate smoothing.  For example, to specify that pressing either button will
  249. cause smoothing, use:
  250.  
  251.     1> JOURNAL TO <file> SMOOTH 0 TRIGGER 0x6000
  252.  
  253. To specify that left Amiga plus left shift together with either button 
  254. should cause smoothing, use:
  255.  
  256.     1> JOURNAL TO <file> SMOOTH 0x0041 TRIGGER 0x6000
  257.  
  258. The complete set of qualifier values is listed in the include file 
  259. "DEVICES/INPUTEVENT.H".  Important values are listed here:
  260.  
  261.     Left Shift          0x0001
  262.     Right Shift         0x0002
  263.     Caps Lock           0x0004
  264.     Control             0x0008
  265.     Left ALT            0x0010
  266.     Right ALT           0x0020
  267.     Left Amiga          0x0040
  268.     Right Amiga         0x0080
  269.     Left Button         0x2000    
  270.     Right Button        0x4000
  271.  
  272. To determine the mask value, take the bitwise OR of the values for the
  273. qualifiers you want to use.   Note that the SMOOTH and TRIGGER masks should be
  274. specified in HEX, not decimal.
  275.  
  276.  
  277. HOW TO USE PLAYABCK:
  278.  
  279. To use playback, type:
  280.  
  281.     1> RUN PLAYBACK FROM <file>
  282.  
  283. where <file> is the name of a journal file recorded with the JOURNAL command.
  284. PLAYBACK should print a message telling you its version number and how to
  285. abort the playback, and then should begin playing back the recorded events. 
  286. All you have to do is sit back and watch. 
  287.  
  288. When PLAYBACK is running, you will not be able to control the mouse yourself,
  289. and the keyboard will have no effect (except for CTRL-C, which cancels 
  290. PLAYBACK).  This is so that you do not disturb the sequence of the journal
  291. being played back.
  292.  
  293. When the last event is played back, PLAYBACK will inform you that it is done.
  294.  
  295. To cancel PLAYBACK at any time, press CTRL-C.  This is the only key that has
  296. any effect while PLAYBACK is running.
  297.  
  298.  
  299. HOW PLAYBACK WORKS:
  300.  
  301. PLAYBACK installs an input handler into the handler chain of the Input.Device.
  302. This handler's priority puts it ahead of Intuition, so it can insert new
  303. events into or remove events from the stream seen by Intuition.  PLAYBACK
  304. reads packed events from the journal file and unpacks them into an event
  305. buffer where the input handler adds them to the event stream.  Since multiple
  306. mouse movements are compressed into single journal records, PLAYBACK must
  307. uncompress these by extrapolating intermediate mouse positions.  The input
  308. handler removes all keyboard and mouse events sent to it by the Input.Device
  309. so that these do not interfere with the journal being played back.  If the
  310. handler sees a CTRL-C it signals PLAYBACK that the user wants to abort the
  311. playback before it is complete.  PLAYBACK then requests the input.Device to
  312. remove the handler.
  313.  
  314. PLAYBACK uses a FIFO event queue to supply events to the input handler.  Since
  315. the handler may have to wait for some time to pass before it posts the next
  316. event in the queue, this allows PLAYBACK to "read ahead" in the journal file, 
  317. and prepare additional events for posting.  This makes the mouse movements
  318. smooth and un-interrupted.  When PLAYBACK fills the queue, it waits for the
  319. handler to post some events (freeing space in the queue).  You can control 
  320. the size of the queue via the EVENTS command-line option.
  321.  
  322.  
  323. PLAYBACK OPTIONS:
  324.  
  325. PLAYBACK supports a number of command-line options that modify its behavior:
  326.  
  327.     FROM <file>     Specifies the journal file to be played back (the keyword
  328.                     "FROM" is optional).
  329.  
  330.     EVENTS n        Specifies the size (in events) of the events buffer
  331.                     used to pass events from PLAYBACK to the input handler.
  332.                     EVENTS must be at least two.  The default value is 50,
  333.                     but it can be set as low as 10 and still provide acceptable
  334.                     performance for some tasks.  The number of events may need
  335.                     to be increased if you have many other tasks running, or
  336.                     are accessing the disk containing the journal file
  337.                     frequently, or have specified small DX and DY values when
  338.                     you recorded the journal file.
  339.  
  340.     SMOOTH          Specifies that compressed mouse moves should be expanded
  341.                     into multiple mouse moves of smaller offsets.  This makes
  342.                     the playback look smoother, and makes precise mouse moves
  343.                     possible without taking up space in the journal file.
  344.                     The default is SMOOTH.
  345.  
  346.     NOSMOOTH        Specifies that compressed mouse moves should be left
  347.                     compressed (i.e., no extrapolated events should be posted).
  348.                     This may be necessary if you need extremely quick response
  349.                     time or if you have specified a small DX and DY during
  350.                     recording and do not need to uncompress mouse moves.
  351.                     The default is SMOOTH.
  352.  
  353.  
  354. HOW TO COMPILE AND LINK JOURNAL AND PLAYBACK:
  355.  
  356. JOURNAL AND PLAYBACK were developed using the Lattice C compiler version 3.10. 
  357. I have tried to make it as generic as possible, but since I don't have the 
  358. Aztex C compiler, I don't know whether it works with Manx.  For Lattice C, all 
  359. you have to do is:
  360.  
  361.     1> lc -v journal playback
  362.     1> asm handlerstub
  363.     1> blink with journal.lnk
  364.     1> blink with playback.lnk
  365.  
  366. The '-v' option is so that no stack checking code will be produced.  Since the
  367. input handler runs on the Input.Device's stack, this would confuse the stack
  368. check code and probably crash the system (I never tried it, though).
  369.  
  370.  
  371. USAGE NOTES:
  372.  
  373. Since PLAYBACK plays back exactly what was recorded by JOURNAL, it is
  374. important that the initial conditions be the same for both JOURNAL and
  375. PLAYBACK.  If even one window is not where it was when your ran JOURNAL, then
  376. PLAYBACK may become hopelessly out of synchronization.
  377.  
  378. It is best to run JOURNAL from a freshly booted system, or a newly opened
  379. NewCLI or AmigaDOS window.   If the journal needs programs or other windows to
  380. be open, don't open them first and then run JOURNAL.  Instead, run JOURNAL and
  381. then open the windows or run the programs.  This way you can be sure that
  382. what you want will be there, and in the proper places.  If you are recording
  383. actions on the Workbench, you should start with all the disk windows closed,
  384. and the disks in their default positions then open them within the journal. 
  385. Beware that disk positions may change depending on the order in which they
  386. were inserted.
  387.  
  388. One "feature" of JOURNAL and PLAYBACK is that they do not know about disk
  389. insert requesters.  If a disk requester comes up, JOURNAL keeps right on
  390. recording mouse moves and key strokes.  If you cancel the requester, so will
  391. PLAYBACK.  But if you put in a disk and the requester goes away, there is no
  392. guarantee that the user who is playing back your journal will replace the disk
  393. in the same amount of time you did (in fact, he may never replace it), so the
  394. rest of the journal may become out-of-synch.  Worse yet, the user can pop a
  395. disk out of the drive at any time, which may cause a disk requester to come up
  396. that did not appear when you recorded the journal, or the user might have
  397. fewer disk drives than you do, so he may have to swap drives differently from
  398. how  you did.   All of these cases cause trouble for JOURNAL and PLAYBACK, so
  399. be careful when you are using multiple disks with journal.  (See FUTURES for
  400. additional comments on disk-requesters).
  401.  
  402. Since JOURNAL will be writing lots of data to its output file, and PLAYBACK
  403. will be reading losts of data from the journal file, the journal file must be
  404. on a disk that can remain in a drive.  RAM: is a good candidate for small
  405. journals, but may not have room for a large journal plus the programs that will
  406. be running.
  407.  
  408. JOURNAL's input handler allocates memory for the events as it copies them.  
  409. This memory is not freed again until JOURNAL actually records the event.  If
  410. events are coming in very fast, JOURNAL may not be able to keep up with them. 
  411. This may use up considerable memory until JOURNAL can catch up.  If you are
  412. having memory problems while using JOURNAL, try slowing down your mouse
  413. movements to give JOURNAL some time to catch up.
  414.  
  415. You may need to run JOURNAL and PLAYBACK at higher priorities than your normal
  416. processes in order to give them enough time to get the events to and from the
  417. input handler in a timely fashion.  Both progams use the Wait() function and
  418. neither "busy waits," so they should cooperate with other tasks even when they
  419. are at a higher priority.
  420.  
  421. If your journal runs a program that has to be loaded from disk, be sure to
  422. wait long enough for it to be loaded during the PLAYBACK.  Some disks take
  423. longer than others, and sometimes there are slight timing differences between
  424. JOURNAL and PLAYBACK.  Give a little extra time after disk accesses before you
  425. move the mouse or press a key.
  426.  
  427. JOURNAL only records mouse and keyboard events that come through the input
  428. device.  It does NOT record events that are received directly by a program
  429. through a message port from devices opened explicitly by the program.  For
  430. example, if your program opens the timer device and gets timer messages, these
  431. are NOT recorded by JOURNAL.  Similarly, JOURNAL does not record messages from
  432. the serial port, parallel port, or second mouse port.  Note that this means
  433. that JOURNAL will not record joystick motions from the second mouse port, so
  434. PLAYBACK can not reproduce them.  This may make it impossible to make a journal 
  435. record of some games.
  436.  
  437.  
  438. FUTURES:
  439.  
  440. The disk insert problem mentioned in USAGE NOTES above needs to be fixed.  The 
  441. only solution I can think of is to use SetFunction to replace AutoRequest with 
  442. a function that signals the JOURNAL or PLAYBACK process that a request has 
  443. occured, then calls the original AutoRequest, then signals when the request is 
  444. finished.  JOURNAL and PLAYBACK would "pause" until the AutoRequest was done,
  445. and then continue recording or playing back.  Since AutoRequest allows you to
  446. specify what kinds of flags will cancel the request, the replacement routine
  447. could check these to see if DISKINSERTED messages will satisfy it.  If not,
  448. then the original AutoRequest could be called without signalling the JOURNAL
  449. or PLAYBACK processes.  This way we would not be trapping the wrong requesters.
  450. Unfortunately, Workbench disk requests do not seem to use the DISKINSERTED
  451. flag, so something more sophsticated may be needed.  I am open to suggestions.
  452.  
  453. In the future (if there is enough interest), I plan to write a journal editor
  454. that allows you to step through a recorded journal and modify it by changing
  455. the events, adding new events, or deleting events.  Also, you will be able to
  456. add "special effects" like pop-up windows that contain explanations of what
  457. your program is doing, what qualifier keys are being pressed, etc.  I also
  458. hope to allow you to do this via the narrator device rather than through a
  459. window, if desired.  If I get real ambitious, I might even add something
  460. to play music from a file, but that will have to be far future for now.  If
  461. you want these features, please let me know.
  462.  
  463.  
  464. AUTHOR:
  465.  
  466. Davide P. Cervone
  467. University of Rochester Computing Center        DPVC@UORDBV.BITNET
  468. Taylor Hall                                     dpvc@tut.cc.rochester.EDU
  469. Rochester, New York  14627                      dpvc@ur-tut.UUCP
  470. (716) 275-2811
  471. SHAR_EOF
  472. #       End of shell archive
  473. exit 0
  474.  
  475. >conv>joined>